const http = require('http');
const fs = require('fs');

const server = http.createServer((req, res) => {
    const urlString = req.url;

    switch (urlString) {
        case '/':
            res.end('home');
            break;
    
        case '/home':
            fs.readFile('./home.html', (err, content) => {
                res.end(content);
            })
            break;
    
        case '/app.js':
            fs.readFile('./app.js', (err, content) => {
                res.end(content);
            })
            break;
        case '/dao.jpeg':
            fs.readFile('./dao.jpeg', (err, content) => {
                res.end(content);
            })
            break;
    
        default:
            res.end('error');
            break;
    }
}).listen(8080)